<?php
header("Content-type: image/png");
session_start();
$im = ImageCreate(119, 19);  
$white = ImageColorAllocate($im, 255, 255, 255); 
$black = ImageColorAllocate($im, 0, 0, 0); 
srand((double)microtime()*1000000); 
$string = md5(rand(0,9999));
$new_string = substr($string, 17, 5); 
ImageFill($im, 0, 0, $black);
ImageString($im, 4, 25, 3, $new_string, $white); 
$_SESSION["validate_sign_session"]=$new_string;
ImagePNG($im); 
ImageDestroy($im); 
?>